package com.ljt.yupictureddd.shared.manager.websocket.model;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum PictureEditActionEnums {

    ZOOM_IN("放大操作", "ZOOM_IN"),
    ZOOM_OUT("缩小操作", "ZOOM_OUT"),
    ROTATE_LEFT("左旋操作", "ROTATE_LEFT"),
    ROTATE_RIGHT("右旋操作", "ROTATE_RIGHT");

    private final String text;

    private final String value;

    PictureEditActionEnums(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取枚举
     *
     * @param value
     * @return
     */
    public static PictureEditActionEnums getEnumByValue(String value) {
        if (StrUtil.isEmpty(value)) {
            return null;
        }
        return Arrays.stream(PictureEditActionEnums.values())
                .filter(space -> space.getValue().equals(value))
                .findFirst()
                .get();
    }
}
